﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="AquariumDetail.aspx.vb" Inherits="FishTank.AquariumDetail" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
        <asp:ScriptManager ID="AquariumDetailScriptManager" runat="server"></asp:ScriptManager>
        <asp:FormView ID="DetailFormView" runat="server" width="100%" CssClass="detailView">
            <EditItemTemplate>
            <div class="itemEdit">
                    <h1>Editing aquarium: <asp:Label ID="titleLbl" runat="server" Text="<%# Bind('Title') %>"></asp:Label></h1>
                    Title:<br />
                    <asp:TextBox ID="TitleTextBox" runat="server" 
                                 Text='<%# Bind("Title") %>' Width="50%" />
                    <br />
                    Description:<br />
                    <asp:TextBox ID="DescriptionTextBox" runat="server" Text='<%# Bind("Description") %>' 
                        Width="50%" Height="128px" TextMode="MultiLine" />
                    <br />
                    Type:<br />
                    <asp:DropDownList ID="AquariumTypeDropDownList" runat="server">
                        <asp:ListItem Value="Freshwater">Freshwater</asp:ListItem>
                        <asp:ListItem Value="Tropical marine">Tropical marine</asp:ListItem>
                        <asp:ListItem Value="Coldwater marine">Coldwater marine</asp:ListItem>
                    </asp:DropDownList>
                    <br />
                    Temperature (°C):<br />
                    <asp:TextBox ID="TemperatureTextBox" runat="server" Text='<%# Bind("Temperature") %>' />
                    <br />
                    Volume (liters):<br />
                    <asp:TextBox ID="VolumeTextBox" runat="server" Text='<%# Bind("Volume") %>' />
                    <br />
                    Product:<br />
                    <asp:DropDownList ID="ProductDropDownList" runat="server">
                        <asp:ListItem Value="tobedone">...List of products here...</asp:ListItem>
                        <asp:ListItem Value="homemade">Homemade</asp:ListItem>
                    </asp:DropDownList>
                    <br />
                    Last Cleaned Date (dd/mm/yyyy):<br />
                    <asp:TextBox ID="LastCleanedTextBox" runat="server" 
                        Text='<%# Bind("LastCleanedDateTime") %>' />
                    <asp:CalendarExtender ID="LastCleanedTextBox_CalendarExtender" runat="server" Format="dd/MM/yyyy"
                        Enabled="True" TargetControlID="LastCleanedTextBox">
                    </asp:CalendarExtender>
                    <br />
                    Cleaning Period (days):<br />
                    <asp:TextBox ID="CleaningPeriodTextBox" runat="server" Text='<%# Bind("PeriodDaysCleaning") %>' />
                    <br />
                    Upload Photo:<br />
                    <asp:FileUpload ID="PhotoFileUpload" runat="server" Width="50%" />
                    <br />
                    Current Photo:<br />
                    <asp:Image ID="AquariumImage" runat="server"
                               ImageUrl='<%# getPhotoPath(Eval("ImagePath")) %>'
                               AlternateText="<%# Bind('ImageTitle') %>" />
                    <br />
                    <asp:Button ID="SaveButton" runat="server" Text="Save" 
                        onclick="SaveButton_Click" />
                    <asp:Button ID="CancelEditButton" runat="server" Text="Cancel" 
                        onclick="CancelEditButton_Click" />
                </div>
            </EditItemTemplate>
            <InsertItemTemplate>
            here insert form...
            </InsertItemTemplate>
            <ItemTemplate>
                <h1><asp:Label ID="titleLbl" runat="server" Text="<%# Bind('Title') %>"></asp:Label></h1>
                <p class="author">
                    by
                    <a href="/Pages/MemberDetail.aspx?UserName=<%# Eval("MemberUserName") %>">
                        <asp:Label ID="MemberLabel" runat="server" Text='<%# Bind("MemberFullName") %>' />
                    </a>
                    at
                    <asp:Label ID="CreatedDateLabel" runat="server" Text='<%# Bind("CreatedDateTime", "{0:MMMM d, yyyy}") %>' />
                </p>
                <p style="width: 100%">
                    <asp:Image ID="AquariumImage" runat="server"
                               ImageUrl='<%# GetPhotoPath(Eval("ImagePath")) %>'
                               AlternateText="<%# Bind('ImageTitle') %>"
                               CssClass="centered" />
                </p>

                <p><asp:Label ID="DescriptionLabel" runat="server" Text='<%# Bind("Description") %>' /></p>

                <dl>
                    <dt>Type</dt>
                        <dd><asp:Label ID="AquariumTypeLabel" runat="server" Text='<%# Bind("AquariumType") %>' /></dd>
                    <dt>Temperature</dt>
                        <dd><asp:Label ID="TemperatureLabel" runat="server" Text='<%# Bind("Temperature") %>' />°C</dd>
                    <dt>Volume</dt>
                        <dd> <asp:Label ID="VolumeLabel" runat="server" Text='<%# Bind("Volume") %>' /> liters</dd>
                    <dt>Product</dt>
                        <dd><a href="<%# Eval("ProductURL") %>"><asp:Label ID="ProductLabel" runat="server" Text='<%# Bind("Product") %>' /></a></dd>
                    <dt>Last Cleaned Date</dt>
                        <dd> <asp:Label ID="LastCleanedDateTimeLabel" runat="server" Text='<%# Bind("LastCleanedDateTime") %>' />
                        </dd>
                    <dt>Cleaning period</dt>
                        <dd>Every <asp:Label ID="PeriodDaysCleaningLabel" runat="server" Text='<%# Bind("PeriodDaysCleaning") %>' /> days</dd>
                </dl>      
                <asp:Button ID="EditButton" runat="server" Text="Edit" Visible="<%# ModificationPermitted() %>"
                        onclick="EditButton_Click" />     
            </ItemTemplate>
        </asp:FormView>
    
        <h2>Comments</h2>

         <asp:ListView ID="NestedDetailListView" runat="server">
            <EmptyDataTemplate>
                <p>This aquarium has no comments yet!</p>
            </EmptyDataTemplate>
            <ItemTemplate>
                <div class="nestedDetailView">
                    <h3><asp:Label ID="TitleLabel" runat="server" Text='<%# Bind("Title") %>' /></h3>
                    <p class="author">
                        by
                        <a href="/Pages/MemberDetail.aspx?UserName=<%# Eval("MemberUserName") %>">
                            <asp:Label ID="MemberLabel" runat="server" Text='<%# Bind("MemberFullName") %>' />
                        </a>
                        at
                        <asp:Label ID="CreatedDateLabel" runat="server" Text='<%# Bind("CreatedDateTime", "{0:MMMM d, yyyy}") %>' />
                    </p>
                    <p  class="textBody"><asp:Label ID="CommentLabel" runat="server" Text='<%# Bind("Description") %>' /></p>
                </div>
            </ItemTemplate>
        </asp:ListView>
    
</asp:Content>
